function combineReducers(reducers) {
  return function combination(state = {}, action) {
    const nextState = {};
    for (const key in reducers) {
      const prevStateForKey = state[key];
      const reducerForKey = reducers[key];
      nextState[key] = reducerForKey(prevStateForKey, action);
    }

    return nextState;
  };
}

export default combineReducers;
